prefix=@prefix@
CFLAGS = @CFLAGS@
CFLAGS += -I. -I./include -I../include -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h
PROG = unikey.o
CC=gcc $(CFLAGS)

MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX

all: $(PROG)

unikey.o: xl_keyhooks.o xl_unikey.o xl_keymasks.o xl_hzfb.o xl_fontmgr.o
	ld -m elf_i386 -r xl_keyhooks.o xl_unikey.o xl_keymasks.o xl_hzfb.o \
           xl_fontmgr.o -o unikey.o

xl_unikey.o: xl_unikey.c /usr/include/linux/version.h
	$(CC) $(MODCFLAGS) -c xl_unikey.c -o xl_unikey.o

xl_keyhooks.o: xl_keyhooks.c /usr/include/linux/version.h
	$(CC) $(MODCFLAGS) -c xl_keyhooks.c -o xl_keyhooks.o

xl_keymasks.o: xl_keymasks.c /usr/include/linux/version.h
	$(CC) $(MODCFLAGS) -c xl_keymasks.c -o xl_keymasks.o

xl_hzfb.o: xl_hzfb.c /usr/include/linux/version.h
	$(CC) $(MODCFLAGS) -c xl_hzfb.c -o xl_hzfb.o
xl_fontmgr.o: xl_fontmgr.c /usr/include/linux/version.h
	$(CC) $(MODCFLAGS) -c xl_fontmgr.c -o xl_fontmgr.o

clean:
	rm -f *.bak *.o xl_unikey.o *~ core $(PROG) 

install: all
	rm -f /dev/unikey ; \
	mknod /dev/unikey c 10 202 ; \
	sh install_module.sh $(PROG)

distclean: clean
	rm -f Makefile tags TAGS
